package cn.school.filter;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import java.util.Date;

/**
 * @author oldliu
 * @since 1.0
 */
@WebListener
public class MySessionCreate implements HttpSessionListener {
    @Override
    public void sessionCreated(HttpSessionEvent httpSessionEvent) {
        System.out.println(httpSessionEvent.getSession().getId()+"创建于："+new Date());
        //System.out.println(httpSessionEvent.getSource()+"他创建的");
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
        System.out.println(httpSessionEvent.getSession().getId()+"销毁于"+new Date());
    }
}
